<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>表单提交-非受控</title>
</head>
<body>
    <div id="test">

    </div>
    <!-- 引入react核心库 -->
    <script type="text/javascript" src="../js/react.development.js"></script>
    <!-- 引入react-dom，用于支持react操作DOM -->
    <script type="text/javascript" src="../js/react-dom.development.js"></script>
    <!-- 引入babel，用于将jsx转为js -->
    <script type="text/javascript" src="../js/babel.min.js"></script>
    <script type="text/javascript" src="../js/prop-types.js"></script>
    <script type="text/babel">
        class Login extends React.Component{
            state = {
                username:'',
                password:''
            }

            hiddleSubmit = (event)=>{
                
                event.preventDefault()
                console.log('hiddleSubmit==>')
                const {username,password} = this
                console.log('submit==>',username.value,password.value)
            }

            

            render(){
                return(
                    <div>
                        <form action="">
                            用户名：<input ref={(c)=>{this.username=c}} type="text"/>
                            密  码：<input ref={(c)=>{this.password=c}} type="password"/>
                            <input onClick={this.hiddleSubmit} type="submit" value="提交"/>

                        </form>
                    </div>
                )
            }
        }
        ReactDOM.render(<Login/>,document.getElementById('test'))
    </script>
</body>
</html>